﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="PhotoUploaderUc.ascx.cs" Inherits="UserControls_PhotoUploaderUc" %>

<script type="text/javascript" language="javaScript">
    function photoUploadSelectedChanged(controlid, photoPath) {
       if(photoPath != "") {
            document.getElementById(controlid).attributes("src").value = photoPath;
            //document.getElementById(controlid).style.visibility = "visible";
       } else {
            document.getElementById(controlid).attributes("src").value = "image_loader.aspx?passengerId=0";
            //document.getElementById(controlid).style.visibility = "hidden";
       }
    }
</script>

<table border="0">
    <tr>
        <td>
            <asp:Label ID="Label1" runat="server" Text="Ảnh trong CSDL"></asp:Label></td>
        <td>
            <asp:Label ID="Label2" runat="server" Text="Ảnh đọc được"></asp:Label></td>
    </tr>
    <tr>
        <td><asp:Image ID="serverPhotoPreview" runat="server" width= "135px" height= "180px" ImageUrl="../image_loader.aspx?passengerId=0"/></td>
        <td><img id="clientPreview" src="image_loader.aspx?passengerId=0" width= "135px" height= "180px"/></td>
    </tr>
    <tr>
        <td colspan="2">
            <asp:CheckBox ID="cbxSavePhoto" runat="server" AutoPostBack="True" Checked="True"
                OnCheckedChanged="cbxSavePhoto_CheckedChanged" Text="Lưu ảnh?" /></td>
    </tr>
    <tr>
        <td colspan="2"><input id="photoUpload" type="file" runat="server" style="width:100%" onfocus='javaScript:photoUploadSelectedChanged("clientPreview",this.value)'/></td>
    </tr>
</table>

